package com.xbzl.cly_demo.dto;

import com.fasterxml.jackson.annotation.JsonFormat;
import java.time.LocalDateTime;

public class VehicleTrackDTO {
    private String vehicleVin;

    @JsonFormat(pattern = "yyyy-MM-dd'T'HH:mm:ss'Z'", timezone = "UTC")
    private LocalDateTime startTime;

    @JsonFormat(pattern = "yyyy-MM-dd'T'HH:mm:ss'Z'", timezone = "UTC")
    private LocalDateTime endTime;

    // 无参构造方法
    public VehicleTrackDTO() {
    }

    // 有参构造方法
    public VehicleTrackDTO(String vehicleVin, LocalDateTime startTime, LocalDateTime endTime) {
        this.vehicleVin = vehicleVin;
        this.startTime = startTime;
        this.endTime = endTime;
    }

    // Getter 和 Setter 方法
    public String getVehicleVin() {
        return vehicleVin;
    }

    public void setVehicleVin(String vehicleVin) {
        this.vehicleVin = vehicleVin;
    }

    public LocalDateTime getStartTime() {
        return startTime;
    }

    public void setStartTime(LocalDateTime startTime) {
        this.startTime = startTime;
    }

    public LocalDateTime getEndTime() {
        return endTime;
    }

    public void setEndTime(LocalDateTime endTime) {
        this.endTime = endTime;
    }

    // toString 方法
    @Override
    public String toString() {
        return "VehicleTrackDTO{" +
                "vehicleVin='" + vehicleVin + '\'' +
                ", startTime=" + startTime +
                ", endTime=" + endTime +
                '}';
    }

    // equals 方法
    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        VehicleTrackDTO that = (VehicleTrackDTO) o;

        if (vehicleVin != null ? !vehicleVin.equals(that.vehicleVin) : that.vehicleVin != null) return false;
        if (startTime != null ? !startTime.equals(that.startTime) : that.startTime != null) return false;
        return endTime != null ? endTime.equals(that.endTime) : that.endTime == null;
    }

    // hashCode 方法
    @Override
    public int hashCode() {
        int result = vehicleVin != null ? vehicleVin.hashCode() : 0;
        result = 31 * result + (startTime != null ? startTime.hashCode() : 0);
        result = 31 * result + (endTime != null ? endTime.hashCode() : 0);
        return result;
    }
}
